/*
 * @Author: Kang
 * @Date: 2022-04-19 23:38:43
 * @Last Modified by: Kang
 * @LastEditTime: 2022-04-20 00:06:27
 */
'use strict';

module.exports = app => {
  /**
  * @controller UserController (用户的Controller)
  */
  class UserController extends app.Controller {
    * sendMail() {
      /**
      * @summary 查询用户全部数据
      * @description 查询用户全部数据
      * @router get /api/user/list
      * @request ()
      * @response 200 JsonBodyResponse  返回结果。
      */
      const { ctx } = this;
      console.log(ctx.request.body)
      // const result = yield this.service.utils.emailUtil.sendMail(ctx.request.body);
      const result = yield this.service.utils.emailUtil.sendMail(ctx.request.body.contact,'安合众道官网咨询客户信息('+ ctx.request.body.phone + ')',ctx.request.body);
      console.log('result',result)
      if(result){
        ctx.body={
          message: '发送成功',
          code:0
        };
      }else{
        ctx.body={
          message: '发送失败',
          code:-1
        };
      }
    }

  }
  return UserController;
};

